Skip to content

Outside work is done by the run first; notes carry what is left, looked up, ordered and confirmable - #356

Merged
nambok merged 1 commit into
mainfrom
outside-work-done-by-the-run
Oct 29, 2026
Merged

nambok merged 1 commit into
mainfrom
outside-work-done-by-the-run

Conversation

@nambok

@nambok nambok commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

A reviewer found an "Also needed outside the code" note with these problems:

  • It said it could not look up the CMS content, though the CMS read API is public.
  • It told editors to add an item that was already there, and didn't say what that item held.
  • It listed content before the studio deploy, which is what puts the new fields in the editor.
  • It gave no exact values and no confirm query.
  • It mixed up the project id and the dataset.
  • It gave every step to a person.

Now the run does that work itself first. A person gets a step only when CoderHelm can't do it, and the note then says why and how to give CoderHelm that access. Code checks every note before it can go out. The ticket note and the PR's "Not in this PR" section are built from the same steps.

Changes

  • Decide who does each step, in code (passes/outside_work.rs). Each step records who does it, checked in this order:

    1. this_pr: the change itself. For example a migration in the repo's migrations folder that replaces the existing item by key, fixtures or e2e setup that create their own content, or config.
    2. coderhelm: CoderHelm, after the PR opens. It starts the studio/staging deploy or e2e workflow (by workflow_dispatch, or by adding the label the workflow runs on) and runs the confirm query (perform). It reports the results: the run link and the query output.
    3. person: only what is left. The step must give why_person (the missing permission or connection, by name) and grant (how to give CoderHelm that access next time).
  • What the repository offers (Abilities):

    • The CMS project id and dataset, read from .env* files (not production ones), sanity.config.*/sanity.cli.* (including process.env.X values) or the codegen environment. A staging dataset is preferred. The public query endpoint is derived from these.
    • Studio/schema deploy and e2e workflows: whether they start by dispatch, by label or on merge, and the command they run.
    • sanity deploy package scripts.
    • The migrations and fixtures folders.
    • Whether the repo has a staging CMS write connection.
  • Planner (plan.rs, fix_location.rs):

    • It gets query_content, a read-only GROQ query on the derived endpoint with no token. It is registered as Read in both tool registries.
    • It is told what the repository offers and the order for deciding who does each step.
    • outside_change gains steps, lookup, existing_items, confirm and names.
  • Note check, which sends the plan back (outside_work::gaps, plan_gaps). A note goes back to the planner when it:

    • says "could not look up" or "assumes none" while a readable source exists, unless a failed attempt's error is quoted;
    • changes content without quoting a lookup;
    • has a lookup that returned items, but the items aren't described (id/key, title, old fields, missing required fields, the PR or branch that left them), or a step adds a second item instead of replacing the existing one;
    • has no ordered steps, or a step has no owner;
    • edits the schema without making the found deploy step 1, by name;
    • gives a person a step that the change or CoderHelm could do (a startable deploy, a migrations folder, e2e setup, a staging write connection, an e2e re-run, a read query);
    • gives a person a step without why_person and grant;
    • has content without values, or without the minimum an e2e test needs;
    • has no confirm query and expected result, or no confirm.e2e;
    • labels the project id or the dataset with the other's name.

    A gap still open after one send-back goes on the decision's open gaps, so the ticket, the PR and the reviewer see it.

  • One source for the ticket and the PR:

  • Plan check (plan_coverage::outside_findings). Every person step goes into Open items:

    • A step with its reason is listed as "not done by this run".
    • A step without a reason is listed as "Not covered".

    A progress note gives both counts.

  • Staging content (feature/content.rs):

    • Without a write connection, existing blocks are looked up through the public read API. "Couldn't look up" appears only when neither the connection nor the read API is available, and it says why.
    • min_items reads the least content the spec needs from its own assertions (toHaveCount, toBeGreaterThan, .nth).
    • Every blocked line is a Blocked with why_person and grant.
  • E2e that skips: PR updates stay true: description, risk, own review, generated types, e2e skips, content notes, questions, ticket comments #353's checklist already fails a spec that skips on missing content, and its guidance says to fail with a message naming the missing content. Nothing changed there.

Verification

  • cargo fmt --all --check: clean.
  • cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test --workspace: 1281 + 2 + 605 + 957 passed, 0 failed.
  • New tests:
    • outside_work::the_reviewed_note_goes_back_with_every_rule: the reviewed note gets every check: the public API, why a person, the startable deploy, the migrations folder, deploy as step 1, values, minimum, confirm and labels.
    • a_lookup_that_found_items_needs_them_described_and_replaced: also checks the rendered note, that the PR uses the same lines, and that a failed lookup quotes its error.
    • reads_the_cms_deploys_and_folders_from_the_repository
    • each_coderhelm_step_gets_its_action
    • the_plan_check_counts_a_person_step_without_a_reason_as_not_covered
    • fix_location::the_ticket_note_and_the_pr_carry_the_same_steps
    • plan_coverage::an_outside_step_without_a_reason_is_not_covered
    • content::without_any_access_the_note_says_why_and_how_to_grant, plus the updated content tests.
  • Not run against a live repository or ticket. Dispatching, adding the label and the public query are covered by unit tests of the decisions, not by live calls.

…ooked up, ordered and confirmable

A reviewer found an "Also needed outside the code" note that said it could
not look up the CMS content while the CMS read API was public, told editors
to add an item that was already there without describing it, put content
before the studio deploy that makes the new fields exist, gave no exact
values or confirm query, mixed up the project id and the dataset, and
handed every step to a person.

- The run does the work first. Each outside step is decided in order and
  recorded with who does it: the change itself (a migration in the
  repository's migrations folder, fixtures or end-to-end setup, config),
  then CoderHelm after the PR opens (starting the studio/staging deploy or
  end-to-end workflow by workflow_dispatch or its label, running the
  confirm query), then a person only for what is left, with why CoderHelm
  couldn't (the missing permission or connection, named) and how to grant
  it. Results (run links, query output) go into the note.
- outside_work reads what the repository offers: the CMS project id and
  dataset from its config, .env files or codegen environment (so the public
  query endpoint is derived), its deploy and end-to-end workflows and
  package scripts, its migrations and fixtures folders.
- The planner gets query_content, a read-only query on that endpoint, and
  the repository's options. Its note is checked in code and sent back when
  it says it couldn't look while a readable source exists, quotes no
  lookup, leaves found items undescribed or adds a second one, has no
  ordered steps with owners, puts content before the schema deploy, gives
  a person a step the change or CoderHelm could do, gives a person a step
  with no reason, has content without exact values or a minimum, has no
  confirm query, or labels an identifier wrongly.
- The ticket note and the PR's Not in this PR section render from the same
  steps; after the PR opens the note is posted once with results (edited in
  place on GitHub) and the PR section is updated with them.
- The plan check counts outside steps: a person's step with its reason is
  listed as not done; one with no reason is listed as not covered.
- content.rs looks existing blocks up through the public read API without a
  write connection, sets the least content from the spec's own counts, and
  every blocked line says why CoderHelm didn't and how to grant it.
@nambok
nambok merged commit f35b0fa into main Oct 29, 2026
8 checks passed
@nambok
nambok deleted the outside-work-done-by-the-run branch October 29, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant